<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
<?=$page_title?>
</title>
<base href="<?=base_url()?>" />
<link href="css/clientpublic.css" rel="stylesheet" type="text/css">
<link href="css/esui.css" rel="stylesheet" type="text/css">
<link href="css/initaccount.css" rel="stylesheet" type="text/css">
<link href="css/guo.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript"
	src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript"
	src="js/fancybox/jquery.easing-1.3.pack.js"></script>
<script type="text/javascript"
	src="js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<link rel="stylesheet" type="text/css"
	href="js/fancybox/jquery.fancybox-1.3.4.css" />
<link rel="stylesheet" type="text/css" href="css/jia.css" />
<script type="text/javascript">
	$(document).ready(function() {
		jQuery.ajaxSetup ({cache:false}); /*让ajax不调用浏览的缓存*/
		$(".various1").fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack',
		'hideOnOverlayClick' : false,
		});

		$(".g_title_sub").click(function(){
            var name=$.trim($("#name").val());
            if(name == ""){
              alert("请输入客户名称后查询");
              $("#name").focus();
            }else{
				location.href="<?=base_url()?>index.php/user/check/"+name+"";
              }
		})

		$("table").delegate('tr',"hover", function(){
			$(this).toggleClass("hover");
		});
	});
</script>
</head>
<body>
	<div id="Holder">
		<div id="MainPage">
			<?php include('top.php')?>
			<div id="Subnav">
				<ul>
					<li class="active show"></li>
				</ul>
			</div>
			<!---------中间部分------------->
			<div id="MainBody">
				<div class="g_title">
					<div class="g_earch">
						 <input type="text" class="g_title_text"
							value="用户名称" onClick="this.value=''" id="name"><input type="button"
							value=" " class="g_title_sub">
					</div>
					<div class="add_customer">
						<div class="add_customer_bg5"><?=anchor('user/show_customer_add/',' ','class="various1"','id="find"') ?></div>
					</div>
				</div>
				<table id="ContentTable" class="data-box">
					<thead>
						<tr class="border-in">
							<th><div>ID</div></th>
							<th><div>角色</div></th>
							<th><div>用户名</div></th>
							<th><div>姓名</div></th>
							<th><div>创建日期</div></th>
							<th><div>最后登录时间</div></th>
							<th><div>操作</div></th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($user as $user_item): ?>
                        <tr class="data-box-row">
                                <td><?=$user_item->id ?></td>
                                <td><?=$user_item->role ?></td>
                                <?php
                                if($user_item->create_time == null || $user_item->create_time == '' || $user_item->create_time == '0000-00-00 00:00:00'){
                                	$createtime = '';
                                }else{
                                	$datatime = strtotime($user_item->create_time);
                                	$createtime = date( "Y-m-d",$datatime);
                                }
                                if($user_item->last_region_time == null || $user_item->last_region_time == '' || $user_item->last_region_time == '0000-00-00 00:00:00'){
                                	$last_region_time = '';
                                }else{
                                	$datatime = strtotime($user_item->last_region_time);
                                	$last_region_time = date( "Y-m-d",$datatime);
                                }
                            ?>
                                <td><?=$user_item->user_name ?></td>
                                <td><?=$user_item->account ?></td>
                                <td><?=$createtime ?></td>
                                <td><?=$last_region_time ?></td>
                                <td><a href="<?=base_url()?>index.php/user/find/<?=$user_item->id ?>"
                                    class="various1 g_see" id="find" title="">查看</a>&nbsp;&nbsp; <a
                                    href="<?=base_url()?>index.php/user/update/<?=$user_item->id ?>"
                                    class="various1 g_edit" id="find" title="">编辑</a>&nbsp;&nbsp; <span class="g_dele"
                                    id="delete<?=$user_item->id ?>">删除</span> <input type="hidden"
                                    id="user_id<?=$user_item->id ?>" value="<?=$user_item->id ?>" />
                                    <script type="text/javascript">
                                         $(function(){
                                             $("#delete<?=$user_item->id ?>").click(function(){
                                                if (window.confirm("您确定要删除吗？")) {
                                                    var id=$("#user_id<?=$user_item->id ?>").val();
                                                    location.href="<?=base_url()?>index.php/user/delete/"+id+"";
                                                } else {
                                                }
                                            })
                                         })
                                    </script></td>
                            </tr>
                      <?php endforeach; ?>
                    </tbody>
				</table>
				<div id="PageControl">
					<div class="page-control">
						<div class="border-in">
							<span class="perpage"> <span class="perpage-text">
							<?php
							 if($pag_links){?>
							 	<?echo ($offset) ? ($offset+1):1;?> - <?=$current_total?> 条（共<?=$total?>条）
							 <?php }
							?>
							</span>
							</span>
							<p>
								<?=$pag_links?>
							</p>
						</div>
					</div>
				</div>

			</div>
			<!---------结尾------------->
			<?php include('footer.php')?>
		</div>
	</div>
</body>
</html>